    //
//  ContentViewController.m
//  Aware
//
//  Created by Willem van Willigen on 04/03/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "ContentViewController.h"


@implementation ContentViewController

@synthesize webView;
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	[super loadView];
	CGRect frame = self.parentViewController.view.bounds;
	frame.size.height = frame.size.height - self.navigationController.navigationBar.bounds.size.height;
	//frame = CGRectMake(0, 0, 703, 704);
	NSLog(@"%@", self.parentViewController);
	NSLog(@"%f %f",frame.size.height, frame.size.width);
	self.webView = [[UIWebView alloc] initWithFrame:frame];
	self.webView.scalesPageToFit = YES;
	[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http:/nu.nl"]]];
	NSLog(@"%@",webView.backgroundColor);
	[self.view addSubview:self.webView];
}

- (void)setup {
	CGRect newFrame = self.parentViewController.view.bounds;
	NSLog(@"%@", self.parentViewController);
	newFrame.size.height = newFrame.size.height - self.navigationController.navigationBar.bounds.size.height;
	NSLog(@"setup: parent bounds: %g %g %g %g", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height);
	webView.frame = newFrame;
	//graphView.midPoint = [graphView defaultMidPoint];//
	//[self updateView];
	if (newFrame.size.width == 703) {
		self.navigationItem.leftBarButtonItem = nil;
		NSLog(@"knopje weggehaald");
	}
	NSLog(@"setup van ContentViewController called");
	
}



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
	[self setup];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)splitViewController:(UISplitViewController *)sv
	 willHideViewController:(UIViewController *)aViewController
		  withBarButtonItem:(UIBarButtonItem *)barButtonItem
	   forPopoverController:(UIPopoverController *)popover {
	barButtonItem.title = aViewController.title;
	self.navigationItem.leftBarButtonItem = barButtonItem;
	NSLog(@"contentViewController svc willhideVC");
}

- (void)splitViewController:(UISplitViewController *)sv
	 willShowViewController:(UIViewController *)aViewController
  invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
	NSLog(@"contentViewController svc willshowVC");
	self.navigationItem.leftBarButtonItem = nil;
}

- (void) viewWillDisappear:(BOOL)animated {
	NSLog(@"ContentViewController viewWillDisappear");
}

- (void)dealloc {
    [super dealloc];
}


@end
